package org.vaillant.todo.common.helpers

class ListHelper {

	static def truncate(List list, int offset=0, int max=10){
		if (!list?.isEmpty()){
			List truncatedList = new ArrayList()
			println "$list.size() - $offset <= $max?$list.size() - $offset:$max"
			int maxList = list.size() - offset <= max?list.size():max

			println "$list.size - $offset - $maxList"
			for (int i=offset;i<maxList;i++){
				truncatedList.add(list.get(i))
			}

			return truncatedList
		}else{
			return list
		}
	}
}
